package com.wxq.demo.controller;

import com.wxq.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @Autowired
    private UserService userService;

    @GetMapping("/admin/test")
    public String admin() {
        return "hello admin";
    }

    @GetMapping("/user/test")
    public String user() {
        return "hello user";
    }

    @GetMapping("/db/test")
    public String dba() {
        return "hello dba";
    }

    @GetMapping("/test")
    public String test() {
        return "hello";
    }

    @GetMapping("/loadUserByUsername")
    public Integer loadUserByUsername(String username) {
        return userService.loadUserByUsername(username).getId();
    }
}
